//
//  SettingCollectionViewCell.m
//  HWZB
//
//  Created by 许成雄 on 2017/4/22.
//  Copyright © 2017年 wonders. All rights reserved.
//

#import "SettingCollectionViewCell.h"

@interface SettingCollectionViewCell()

@property (strong, nonatomic) UIImageView *iconImageView;
@property (strong, nonatomic) UILabel *titleLabel;

@end

@implementation SettingCollectionViewCell

- (instancetype)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    CGFloat width = SCREEN_WIDTH / 3;
//    CGFloat height = width;
    if(self) {
        self.iconImageView = [[UIImageView alloc] initWithFrame:CGRectMake((width - TRANS_VALUE(24.0f)) / 2, TRANS_VALUE(30.0f), TRANS_VALUE(24.0f), TRANS_VALUE(24.0f))];
        self.iconImageView.contentMode = UIViewContentModeScaleAspectFit;
        [self.contentView addSubview:self.iconImageView];
        
        self.titleLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, TRANS_VALUE(60.0f), width, TRANS_VALUE(20.0f))];
        self.titleLabel.textColor = I_COLOR_33BLACK;
        self.titleLabel.textAlignment = NSTextAlignmentCenter;
        self.titleLabel.font = [UIFont systemFontOfSize:TRANS_VALUE(11.0f)];
        [self.contentView addSubview:self.titleLabel];
    }
    self.contentView.backgroundColor = I_COLOR_WHITE;
    self.contentView.clipsToBounds = YES;
    self.contentView.layer.borderWidth = 0.5f;
    self.contentView.layer.borderColor = I_COLOR_GRAY.CGColor;
    
    return self;
}

- (void)setSettingItemInfo:(SettingItemInfo *)settingItemInfo {
    _settingItemInfo = settingItemInfo;
    if(_settingItemInfo) {
        self.iconImageView.image = [UIImage imageNamed:_settingItemInfo.icon];
        self.titleLabel.text = _settingItemInfo.title;
    }
}

@end
